//
//  MsgTableViewCell.m
//  Kfangchan
//
//  Created by 朋飞 on 14-11-19.
//  Copyright (c) 2014年 Beijing Renjuren Network Technology Co., Ltd. All rights reserved.
//

#import "MsgTableViewCell.h"
@interface MsgTableViewCell()

@property (strong, nonatomic) IBOutlet UILabel *titleLabel;

@property (strong, nonatomic) IBOutlet UIView *lineView;


@property (strong, nonatomic) IBOutlet UIImageView *pointImag;
@end

@implementation MsgTableViewCell

- (void)awakeFromNib {
    self.lineView.size = CGSizeMake(320, 0.5);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


-(void) initCell:(Notice *)entity{
    
    self.notice = entity;
    // 未读
    if(self.notice.status == 0){
        self.titleLabel.textColor=[UIColor colorWithHexString:@"f04137"];
        self.pointImag.image =[UIImage imageNamed:@"icon_point_red.png"];
    }else{
        if(self.notice.isExpand){
            self.titleLabel.textColor=[UIColor colorWithHexString:@"9c9c9c"];
            self.pointImag.image =[UIImage imageNamed:@"icon_point_grey.png"];
            
        }else{
            self.titleLabel.textColor=[UIColor colorWithHexString:@"5e5e5e"];
            self.pointImag.image =[UIImage imageNamed:@"icon_point_black.png"];
            
        }
        
        
    }
    self.titleLabel.text = self.notice.title;
    ////////mosn
    CGRect rect = [NSString heightForString:self.notice.content Size:CGSizeMake(self.contentLabel.width, 999) Font:[UIFont systemFontOfSize:15]];
    self.contentLabel.height = rect.size.height;
    ////////
    self.contentLabel.text = self.notice.content;
    self.addTimeLabel.originY = self.contentLabel.originY+rect.size.height+5;
    self.addTimeLabel.text = self.notice.addTime;

    if(!self.notice.isExpand){
        
        self.lineView.origin = CGPointMake(0, 49);
    }else{
      
        self.lineView.origin = CGPointMake(0, self.addTimeLabel.originY+self.addTimeLabel.height+15);
    }
    
    self.contentLabel.hidden = !self.notice.isExpand;
    self.addTimeLabel.hidden = !self.notice.isExpand;
    
}
@end
